﻿using AnlianCommon.Common.Domains.BreedingManagement;
using AnlianCommon.Common.Domains.ProductionManagement;
using AnlianCommon.Common.Domains.SheepManagement;
using AnlianCommon.Common.DTO;
using AnlianCommon.Enum;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SheepCommon.API.SheepCommands;
using SheepCommon.API.SheepCommands.Breedingsettinges;
using SheepCommon.API.SheepCommands.EChartsCommon;
using SheepCommon.API.SheepCommands.EwesGiveBirthes;
using SheepCommon.API.SheepCommands.FirstPregnancyTestPromptes;
using SheepCommon.API.SheepCommands.MeasurementBodyes;
using SheepCommon.API.SheepCommands.PhaseDeterminationes;
using SheepCommon.API.SheepCommands.PregnancyTestes;
using SheepCommon.API.SheepCommands.SheepCullinges;
using SheepCommon.API.SheepCommands.SheepDiees;
using SheepCommon.API.SheepCommands.SheepTransferes;
using SheepCommon.API.SheepCommands.SheepWeighedes;
using Yitter.IdGenerator;

namespace SheepCommon.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheepArchiveController : ControllerBase
    {
        private readonly IMediator _mediator;

        public SheepArchiveController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 档案新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepArchivesCreate(SheepArchivesCreateCommand request, CancellationToken cancellationToken)
        {
            //雪花ID
            request.RecordAuricle = YitIdHelper.NextId().ToString();
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 档案列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<SheepArchivesQueryDto>> SheepArchivesQuery(SheepArchivesQueryCommand request, CancellationToken cancellationToken)
        {

            var result = await _mediator.Send(request);
            return result;
           
        }

        /// <summary>
        /// 羊只转舍新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepTransferCreate(SheepTransferCreateCommand request, CancellationToken cancellationToken)
        {
            var result =await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 羊只转舍查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<SheepTransferQueryDto>> SheepTransferQuery(SheepTransferQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母配种新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> BreedingsettingCreate(BreedingsettingCreateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母配种查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<BreedingsettingQueryDto>> BreedingsettingQuery(BreedingsettingQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母妊检新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> PregnancyTestCreate(PregnancyTestCreateCommand request, CancellationToken cancellationToken)
        {
            var result =await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母妊检查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<PregnancyTestQueryDto>> PregnancyTestQuery(PregnancyTestQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母分娩新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> EwesGiveBirthCreate(EwesGiveBirthCreateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母分娩查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<EwesGiveBirthQueryDto>> EwesGiveBirthQuery(EwesGiveBirthQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 称重新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepWeighedCreate(SheepWeighedCreateCommand request, CancellationToken cancellationToken)
        {
            var result = await  _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 称重查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<SheepWeighedQueryDto>> SheepWeighedQuery(SheepWeighedQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 体尺测定新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> MeasurementBodyCreate(MeasurementBodyCreateCommand request, CancellationToken cancellationToken)
        {
            var result =await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 体尺测定查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<MeasurementBody>> MeasurementBodyQuery(MeasurementBodyQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 品相增加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> PhaseDeterminationCreate(PhaseDeterminationCreateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 品相列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<PhaseDetermination>> PhaseDeterminationQuery(PhaseDeterminationQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 羊只死亡新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepDieCreate(SheepDieCreateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 羊只死亡查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<SheepDie>> SheepDieQuery(SheepDieQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 羊只淘汰新增
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepCullingCreate(SheepCullingCreateCommand request, CancellationToken cancellationToken)
        {
            var result =await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 羊只淘汰查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<SheepCulling>> SheepCullingQuery(SheepCullingQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母配种删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> BreedingsettingDeleted(BreedingsettingDeletedCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母配种反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> BreedingsettingBackFill(BreedingsettingBackFillCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母配种修改
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> BreedingsettingUpdate(BreedingsettingUpdateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母妊检删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> PregnancyTestDeleted(PregnancyTestDeletedCommand request, CancellationToken cancellationToken)
        {
            var result =await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母妊检反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> PregnancyTestBackFill(PregnancyTestBackFillCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母妊检修改
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> PregnancyTestUpdate(PregnancyTestUpdateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母分娩删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> EwesGiveBirthDeleted(EwesGiveBirthDeletedCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母分娩反填
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> EwesGiveBirthBackFill(EwesGiveBirthBackFillCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种母分娩修改
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> EwesGiveBirthUpdate(EwesGiveBirthUpdateCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 查询全部耳号
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepEarBuglesQuery(SheepEarBuglesQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 种公耳号查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepEarBuglesPrhQuery(SheepEarBuglesPrhQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 查询种母耳号
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepEarBuglesEweQuery(SheepEarBuglesEweQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 查询后裔耳号后裔
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepEarBuglesProgenyQuery(SheepEarBuglesProgenyQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 档案详情
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result<SheepArchivesDetailDto>> SheepArchivesDetail(SheepArchivesDetailCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 通过耳号选择下拉加载档案信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepEarBuglesBackFill(SheepEarBuglesBackFillCommand request, CancellationToken cancellationToken)
        {
            var result =await _mediator.Send(request);  
            return result;
        }
        /// <summary>
        /// 查询系谱
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> SheepBloodlineQuery(SheepBloodlineQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 首次妊检提示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> FirstPregnancyTestPromptQuery(FirstPregnancyTestPromptQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }
        /// <summary>
        /// 分娩提示
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultPage<ChildbirthTipQueryDto>> ChildbirthTipQuery(ChildbirthTipQueryCommand request, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(request);
            return result;
        }

    }
}
